def foo():
    print("starting...")
    for i in range(4):
        res = yield i
        print("res:",res)
g = foo()
print(next(g))
print("*"*20)
print(next(g))